package com.mewpipe.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name="comments")
@XmlRootElement
public class Comment implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id	@GeneratedValue(strategy=GenerationType.AUTO)
	private long id;
	
	private long idUser;
	private String auteur;
	private Date date_crea;
	private String commentaire;
	private int nbLike;
	private int nbDislike;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public long getIdUser() {
		return idUser;
	}
	public void setIdUser(long idUser) {
		this.idUser = idUser;
	}
	public String getAuteur() {
		return auteur;
	}
	public void setAuteur(String _auteur) {
		auteur = _auteur;
	}
	public Date getDate_crea() {
		return date_crea;
	}
	public void setDate_crea(Date date_crea) {
		this.date_crea = date_crea;
	}
	public String getCommentaire() {
		return commentaire;
	}
	public void setCommentaire(String _commentaire) {
		commentaire = _commentaire;
	}
	public int getNbLike() {
		return nbLike;
	}


	public int getNbDislike() {
		return nbDislike;
	}
	private void setNbLike() {
		this.nbLike = this.nbLike + 1;
	}


	private void setNbDislike() {
		this.nbDislike = this.nbDislike + 1;
	}
	
	public void incrementlike(){
		this.setNbLike();
	}

//fonction d'incrementation dislike
	public void incrementdislike(){
		this.setNbDislike();
	}

}
